<?php


namespace App\Http\Controllers\Product;


use App\Http\Controllers\Controller;
use App\Http\Searchs\Product\InventorySearch;
use App\Repositories\ProductInventory;

class InventoryController extends Controller
{
    /**
     * @var ProductInventory
     */
    private $inventory;

    /**
     * InventoryController constructor.
     * @param ProductInventory $inventory
     */
    public function __construct(ProductInventory $inventory)
    {
        $this->inventory = $inventory;
    }

    /**
     * @param InventorySearch $search
     * @return \Illuminate\Http\JsonResponse
     */
    public function index(InventorySearch $search){
        return $this->response(
            $this->inventory->paginate($search->toArray())
        );
    }
}
